//
//  PriceView.m
//  FruitVIP
//
//  Created by 孙艳玲 on 15/5/21.
//  Copyright (c) 2015年 孙艳玲. All rights reserved.
//

#import "PriceView.h"

@implementation PriceView

- (instancetype)initWithFrame:(CGRect)frame 
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSub];
    }
    return self;
}

- (void)createSub
{
    UILabel *allPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width / 5, self.frame.size.height)];
    allPriceLabel.text = @"总金额:";
    allPriceLabel.font = [UIFont systemFontOfSize:13];
    allPriceLabel.textAlignment = NSTextAlignmentCenter;
    allPriceLabel.textColor = [UIColor whiteColor];
    [self addSubview:allPriceLabel];
    
    UILabel *priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(allPriceLabel.frame.origin.x + allPriceLabel.frame.size.width, allPriceLabel.frame.origin.y, allPriceLabel.frame.size.width, allPriceLabel.frame.size.height)];
    priceLabel.text = @"79";
    priceLabel.font = [UIFont systemFontOfSize:14];
    priceLabel.textColor = [UIColor whiteColor];
    [self addSubview:priceLabel];
    
    
    
    UIButton *payButton = [UIButton buttonWithType:UIButtonTypeCustom];
    payButton.frame = CGRectMake(3 * self.frame.size.width/ 4, priceLabel.frame.origin.y,  self.frame.size.width / 4, priceLabel.frame.size.height);
    payButton.backgroundColor = [UIColor orangeColor];
    [payButton setTitle:@"立即支付" forState:UIControlStateNormal];
    payButton.titleLabel.font = [UIFont systemFontOfSize:13];
    [payButton addTarget:self action:@selector(payButtonAction) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:payButton];

}

- (void)payButtonAction
{
    NSLog(@"立即支付");
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
